<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%--//引用jstl表达式--%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":"
            + request.getServerPort() + path + "/";
%>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>网站后台管理系统HTML模板--模板之家 www.cssmoban.com</title>
    <link href="<%=basePath%>jsp/backstage/css/style.css" rel="stylesheet"
          type="text/css"/>
    <script type="text/javascript" src="<%=basePath%>jsp/backstage/js/jquery.js"></script>
    <script type="text/javascript">
        //用于弹出窗口，将服务器返回的数据提交，本处用于账户提交后的状态
        <%--function alert_myMessage() {--%>
        <%--    var message = "${requestScope.myMessage}";--%>
        <%--    if (message != "") {--%>
        <%--        alert(message);--%>
        <%--    }--%>
        <%--}--%>

        //页面加载后起作用
        // $(document).ready(function () {
        //     alert_myMessage();//调用上面的函数，用于弹出窗口
        //     $('.tablelist tbody tr:odd').addClass('odd');//表格隔行变色（斑马线效果）
        //     $('a[name="deleteClick"]').click(()=>{
        //         alert(11)
        //     })
        // });
        // document.querySelector('a[name="deleteClick"]').addEventListener('click',()=>{
        //     alert(11)
        // })
    </script>


</head>

<body>
<div class="place">
    <span>位置：</span>
    <ul class="placeul">
        <li><a href="#">首页</a></li>
        <li><a href="<%=basePath%>backstage/adminmanage/all">管理账户管理</a></li>
    </ul>
</div>
<div class="rightinfo">
    <div class="tools">
        <ul class="toolbar">
            <a href="#">
                <li class="click">
				   <span>
				      <img src="<%=basePath%>jsp/backstage/images/t01.png"/>
				   </span><a href="<%=basePath%>backstage/adminmanage/toAdd">添加管理账户</a>
                </li>
            </a>
        </ul>
    </div>
    <div>
        <table class="tablelist">
            <tr>
                <td style="width:4% "><input type="checkbox"></td>
                <td style="width:10%">账户名</td>
                <td style="width:10%">姓名</td>
                <td style="width:16%">密码</td>
                <td style="width:10%">性别</td>
                <td style="width:10%">是否锁定</td>
                <td style="width:26%">创建时间</td>
                <td style="width:4%">操作</td>
            </tr>
<c:forEach var="one" items="${requestScope.admin}">
                <tr>
                    <td style="width:4% "><input type="checkbox" value="${one.id}"></td>
                    <td style="width:10%">${one.userName}</td>
                    <td style="width:10%">${one.name}</td>
                    <td style="width:16%">${one.password}</td>
                    <td style="width:10%">

                        <c:choose>
                            <c:when test="${one.isSex()==1}">男</c:when>
                            <c:otherwise>女</c:otherwise>
                        </c:choose>
                    </td>
                    <td style="width:10%">

                                <c:choose>
                                    <c:when test="${one.unlocked==true}">不锁定</c:when>
                                    <c:otherwise>锁定</c:otherwise>
                                </c:choose>
                    </td>
                    <td style="width:26%">
                        <fmt:formatDate value="${one.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
                    </td>
                    <td style="width:6%">
                        <a href="<%=basePath%>backstage/adminmanage/toUpdate?id=${one.id}" class="tablelink">修改</a>
                        <a href="<%=basePath%>backstage/adminmanage/delete?id=${one.id}" class="tablelink" name="deleteClick">删除</a>
                    </td>
                </tr>
</c:forEach>
        </table>
    </div>
    <div class="pagin">
        <div class="message">
            共<i class="blue">${requestScope.admin.size()}</i>条记录
        </div>
    </div>
</div>
</div>
<script>
    $('a[name="deleteClick"]').click(()=>{
        return confirm("确定要删除吗？删除后无法恢复！")
    })
    let msg='${requestScope.alert_msg}'
    if (msg!=''){
        alert(msg)

    }
</script>
</body>
</html>
